<?php

/* 

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */
session_start();
require("db_conn.php");
if (isset($_POST))
{
   if (trim($_POST["yzm"])==$_SESSION['code'])
   {
        //搜集用户填写的信息 

         $yhm=trim($_POST["yhm"]);

         $dlmm=md5(trim($_POST["dlmm"]));

         $sql="insert into users(yhm,dlmm) values('$yhm','$dlmm')";
         $rs=$db->query($sql);
         if ($rs)
         {
             echo "<script language='javascript' type='text/javascript'>";
             echo "alert('注册成功，请登录！');";
             echo "window.location.href='./admin/login.php'";
             echo "</script>";
         }
         else
         {
             echo "<script>alert('注册失败！');window.location.href='regsiter_3.php'</script>";
         }
    }
   else
   {
        echo "<script>alert('验证码错误！');window.location.href='regsiter_3.php'</script>";
   }
     
}